const BaseIpcHandler = require('../BaseIpcHandler');
const BaseDatasetWrapper = require('../../labels/BaseDatasetWrapper');

class GetDatasetFormatHandler extends BaseIpcHandler {
    async handle(event, params) {
        // 解析参数
        // console.log('>> GetDatasetFormatHandler params = ', params);
        const dataset_info = params;

        // 业务逻辑
        let result = null;
        result = await BaseDatasetWrapper.analyzeFormat(this.app, dataset_info);

        // 返回结果
        if (event.from === 'localserver') {
            event.resp.send(result);
        } else {
            return result;
        }
    }
}

module.exports = GetDatasetFormatHandler;
